package j16;

public class J16_OOP_Q72 {

	public static void main(String[] args) {
		//상속, 인터페이스, 기본 클래스를 이용해서
		//사각형 둘레 및 면적 계산하는 프로그램을 작성

		J16Retangle r = new J16Retangle(5.13, 40.52);
		
		System.out.println(r.toString());
		System.out.println(r.getArea());
		System.out.println(r.getCircum());
	}	//main

}		//class

//클래스
class J16Shape implements J16ShapeService {
	private double width;
	private double height;
	
	public J16Shape() {}
	
	public J16Shape(double width, double height) {
		super();
		this.width = width;
		this.height = height;
		
		
	}

	public double getWidth() {
		return width;
	}

	public void setWidth(double width) {
		this.width = width;
	}

	public double getHeight() {
		return height;
	}

	public void setHeight(double height) {
		this.height = height;
	}

	@Override
	public String toString() {
		return "J16Shape [ width = " + width + ", height = " + height + "]";
	}

	@Override
	public double getArea() {
		
		return 0;
	}

	@Override
	public double getCircum() {
		
		return 0;
	}
	
	
	
}


//인터페이스

interface J16ShapeService {
	double getArea	();
	double getCircum();
}

// 사각형 클래스
class J16Retangle extends J16Shape {
	
	 public J16Retangle(double w,double h) {
		super(w,h);
		//객체 초기화시
		//부모 클래스 Shape의 생성자를 호출
	}
	 
	@Override
	public double getArea() {
		double area = getHeight()*getWidth();
		return area;
	}
	
	@Override
	public double getCircum() {
		double circum = getHeight()*2 + getWidth()*2;
		return circum;
	}
	
}

//과제
//J16Circle :원둘레, 원너비;
//J16Triangle :둘레, 너비;




